package com.cskaoyan.app.wxcontroller;


import com.cskaoyan.app.bean.common.BaseRespVo;
import com.cskaoyan.app.bean.vo.wx.WxSearchIndexVo;
import com.cskaoyan.app.wxservice.WxSearchService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//wx	      wx	     wx
//search	search	    search
//index	    helper	    clearhistory
//http://182.92.235.201:8083/wx/search/index
@RestController
@RequestMapping("wx/search")
public class WxSearchController {

    @Autowired
    WxSearchService wxSearchService;

    @GetMapping("index")
    public BaseRespVo index() {
        WxSearchIndexVo data = wxSearchService.index();
        return BaseRespVo.ok(data);
    }

    //http://182.92.235.201:8083/wx/search/clearhistory
    @PostMapping("clearhistory")
    public BaseRespVo clearhistory() {

        wxSearchService.clearhistory();

        return BaseRespVo.ok();
    }

    //http://182.92.235.201:8083/wx/search/helper?keyword=%E5%B0%8F
    @GetMapping("helper")
    public BaseRespVo helper(String keyword) {


        List<String> list = wxSearchService.helper(keyword);

        return BaseRespVo.ok(list);

    }
}
